# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=winfile
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=10.2.0.0
pkgrel=1
pkgdesc="Original Windows File Manager (winfile) with enhancements (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/microsoft/winfile"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
options=(!strip staticlibs !buildflags)
source=("${_realname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('441ec49ca6ad3af6abb3169a5f95e84ce00d3e3a9dedaf33f1088f4e4ac32524')

build() {
  [[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
  cp -r "${srcdir}/${_realname}-${pkgver}" "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  CC=cc CXX=c++ make
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  mkdir -p "${pkgdir}${MINGW_PREFIX}"/bin
  cp winfile.exe "${pkgdir}${MINGW_PREFIX}"/bin/

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}"/share/licenses/${_realname}/LICENSE
}
